package com.xyc.wemedia.order.controller;

import com.xyc.wemedia.order.service.LocationService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("address")
public class WeMediaController {
    @Resource
    private LocationService locationService;
    //private static List<String> provinceList = new ArrayList<>();//省集合
  /*  private static Map<String,List<String>> cityMap = new HashMap<>();//市
    private static Map<String,List<String>> areaMap = new HashMap<>();//区*/



    @ResponseBody
    @RequestMapping("province")
    public List<String> returnProvince(){
        List<String> provinceList = locationService.queryProvince();//省集合
        return provinceList;
    }

    @ResponseBody
    @RequestMapping("city")
    public List<String> returnCityByProvince(String province){
        List<String> cityByProvince = locationService.queryCityByProvince(province);
        return  cityByProvince;
    }

    @ResponseBody
    @RequestMapping("area")
    public List<String> returnAreaByCity(String city){
        List<String> areaByCity = locationService.queryAreaByCity(city);
        return areaByCity;
    }


}
